Saltar al contenido principal

Historial de Chat

Descripción de la API para obtener el historial de chats.

Este recurso te permitirá obtener el historial de mensajes de un bot.

[GET] [https://api.jelou.ai/v1/external/messages/history/BOT_ID]

Parámetros de ruta

PropiedadTipo de datoRequeridoDescripción
botIdstring✅ SíID del bot.

Parámetros de consulta

PropiedadTipo de datoRequeridoDescripción
limitint✅ SíNúmero de mensajes a solicitar.
pageint✅ SíNúmero de página.
startAtdate❌ NoFecha de inicio del rango a consultar.
endAtdate❌ NoFecha fin del rango a consultar.
clientIdstring❌ NoID del cliente.
messageIdstring❌ NoID de mensaje.

Respuestas del historial de chat

tip

En caso de omitir los campos opcionales, se utilizarán los valores predeterminados.

Ejemplo de solicitud

curl --request GET \
--url 'https://api.jelou.ai/v1/external/messages/history/BOT_ID?limit=10&page=1' \
--header 'Authorization: Basic {{Base64EncodedUsername:Password}}'

Respuestas de la API

🟢 200 - Successful response

{
"pagination": {
"limit": 10,
"page": 1,
"total": 1,
"offset": 0,
"totalPages": 1
},
"_metadata": {},
"results": [
{
"recipient": {
"id": "1234567890",
"names": "John Doe"
},
"sender": {
"id": "bot-12345-67890-abcde-fghij",
"name": "Your Company Bot",
"type": "Whatsapp"
},
"by": "bot",
"messageId": "msg-12345-67890-4a38-abcde-fghij",
"status": "DELIVERED_USER",
"bubble": {
"type": "TEXT",
"text": "Hello, welcome to Jelou"
},
"createdAt": "2025-01-15T10:30:00.000Z"
}
]
}

🔴 401 - Unauthorized

{
"message": "Authentication failed"
}

🔴 404 - Not Found

{
"message": [
"The Bot could not be found at the moment."
],
"statusMessage": "failed",
"status": 0,
"error": {
"code": "E1019",
"key": "BOT_NOT_FOUND",
"description": "Error to be thrown when trying to get a Bot.",
"developerMessages": {
"es": "El botId no se encuentra en la base de datos o ha sido eliminado.",
"en": "The botId is not found in the database or has been deleted.",
"pt": "A botId não é encontrada no banco de dados ou foi apagada."
},
"clientMessages": {
"es": "El Bot no se pudo encontrar por el momento.",
"en": "The Bot could not be found at the moment.",
"pt": "A Bot não pôde ser encontrada no momento."
}
}
}

🔴 422 - Unprocessable Entity

{
"message": [
"Los valores ingresados no son correctos."
],
"statusMessage": "failed",
"status": 0,
"error": {
"code": "E0422",
"key": "VALIDATOR_ERROR",
"description": "Error to be thrown when cannot process request because of incoming values",
"developerMessages": {
"es": "Los valores del request no son correctos para ser procesados.",
"en": "The request values are not correct for processing."
},
"clientMessages": {
"es": "Los valores ingresados no son correctos.",
"en": "The values entered are not correct."
}
},
"validationError": {
"startAt": [
{
"es": "el campo startAt debe ser una fecha",
"en": "the startAt field must be a Date",
"pt": "o campo startAt deve ser uma data"
}
]
}
}

🔴 500 - Internal Server Error

{
"message": [
"We are having trouble processing your request. Please try again later."
],
"statusMessage": "failed",
"status": 0,
"error": {
"code": "E0000",
"key": "UNKNOWN_ERROR",
"description": "Error to be thrown when it couldn't be determined the reason of failure",
"developerMessages": {
"es": "Error inesperado occurido, revisar logs.",
"en": "Unexpected error occurred, check logs."
},
"clientMessages": {
"es": "Estamos teniendo problemas procesando la solicitud. Por favor intenta mas tarde.",
"en": "We are having trouble processing your request. Please try again later."
}
}
}